package com.umfwechat.common;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public class ResMessage implements Serializable {

	private static final long serialVersionUID = -1260201204880657574L;

	private String rpid = "";

	/**
	 * 返回码
	 */
	private String retCode = "";

	/**
	 * 返回信息
	 */
	private String retMsg = "";

	/**
	 * 耗时 （单位ms）
	 */
	private long tookTime;

	public ResMessage() {

	}

	public ResMessage(String rpid, String retCode, String retMsg) {
		this.rpid = rpid;
		this.retCode = retCode;
		this.retMsg = retMsg;
	}

	/**
	 * 输出
	 */
	private Map<String, Object> resMap = new HashMap<String, Object>();

	public String toString() {
		StringBuffer stringBuffer = new StringBuffer();
		stringBuffer.append("rpid[").append(rpid)
		            .append("] retCode[").append(retCode)
		            .append("] retMsg[").append(retMsg)
		            .append("] tookTime[").append(tookTime)
		            .append("]");
		return stringBuffer.toString();
	}

	public Object getValue(String key) {
		return resMap.get(key);
	}

	public String getStrValue(String key) {
		return (String) resMap.get(key);
	}

	public void put(String key, Object value) {
		resMap.put(key, value);
	}

	public String getRetCode() {

		return retCode;
	}

	public void setRetCode(String retCode) {
		this.retCode = retCode;
	}

	public String getRetMsg() {

		return retMsg;
	}

	public void setRetMsg(String retMsg) {

		this.retMsg = retMsg;
	}

	public long getTookTime() {

		return tookTime;
	}

	public void setTookTime(long tookTime) {

		this.tookTime = tookTime;
	}

	public Map<String, Object> getResMap() {

		return resMap;
	}

	public void setResMap(Map<String, Object> resMap) {

		this.resMap = resMap;
	}

	public String getRpid() {

		return rpid;
	}

	public void setRpid(String rpid) {

		this.rpid = rpid;
	}

	public void put(Map<String, Object> data) {
		this.resMap.putAll(data);
	}
	
	public void putStrMap(Map<String, String> data) {
		this.resMap.putAll(data);
	}
}
